const app = getApp()
var module=require("../../../utils/shanghai/qujinbo.js");
Page({
  data: {
    language: 'zh',
    currentLat:31.188349,
    currentLng: 121.298064,
    name:"",
    address:'',
    show:true,
  },
  onLoad:function(){
    var lang=app.globalData.lang;
    if (lang != "zh") {
      wx.setNavigationBarTitle({
        title: 'Travel'
      })
    }
    this.setData({
      language:lang,
      name: lang == 'zh' ? '中国国际进口博览会' : 'CIIE',
      address: lang== 'zh' ? '2号线徐泾东站6号出口' : 'Exit metro at exit 6 of line 2 Xujingdong Station',
    });
  },
  goto(e){
    switch(e.currentTarget.dataset.method){
        case '1':{
          wx.openLocation({
            latitude:this.data.currentLat,
            longitude:this.data.currentLng,
            name:this.data.name,
            address:this.data.address,
            scale: 14.5,
          });
        }break;
        case '2':{
        const url = this.data.language == 'zh' ? 'https://ciie.naviguy.com/ciienavi/?key=2018102402' : 'https://ciie.naviguy.com/ciienavi/?key=2018102402';
          wx.navigateTo({
            url: '/pages/h5/index?url=' +encodeURIComponent(url)
          });
        }break;
    }
    
  },
  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {
    var that = this;
    return {
      title: app.globalData.shareTitle,
      path: app.globalData.sharePath,
      imageUrl: '../../../images/share_img.png',
      success: function (res) {
        // 转发成功
      },
      fail: function (res) {
        // 转发失败
      }
    }
  },

})